Skip to content

fix(ui): avoid setState-in-effect in RunHistoryStrip to unblock lint (#357)#358

Merged
w7-mgfcode merged 1 commit into
devfrom
fix/ui-runhistorystrip-setstate-in-effect
Jun 1, 2026
Merged

fix(ui): avoid setState-in-effect in RunHistoryStrip to unblock lint (#357)#358
w7-mgfcode merged 1 commit into
devfrom
fix/ui-runhistorystrip-setstate-in-effect

Conversation

@w7-mgfcode
Copy link
Copy Markdown
Owner

What

Fixes the pre-existing react-hooks/set-state-in-effect error in
frontend/src/components/demo/RunHistoryStrip.tsx that made the whole-repo
pnpm lint gate (eslint .) red on dev.

How

The effect appended a run-history entry by calling setItems / setLastSummary
synchronously in its body. Refactored to:

  1. Append during render using React's "storing information from previous
    renders" pattern (guarded if (summary && summary !== lastSummary)), so no
    setState happens inside an effect body.
  2. Persist to localStorage in a dedicated effect keyed on items — syncing
    React state to an external system is the sanctioned use of an effect.

Behavior is unchanged: one history entry per pipeline_complete summary,
FIFO-capped at HISTORY_CAP, persisted to the same versioned localStorage key.

Validation

  • pnpm lint0 errors (was 1 error; 1 unrelated pre-existing warning remains).
  • pnpm tsc --noEmit → clean.
  • pnpm test --run → all green; RunHistoryStrip.test.tsx 5/5.

Scope: one file. Closes #357.

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @w7-mgfcode, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 1, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9dbcaffe-27f9-4e75-81e8-1597cde2f3b8

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/ui-runhistorystrip-setstate-in-effect

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@w7-mgfcode w7-mgfcode merged commit 4d4c471 into dev Jun 1, 2026
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant